﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Test_Drag_N_drop
{
    class ButtonBlock : Button
    {
        private TypeOfBlock type;


        public ButtonBlock (TypeOfBlock type) : base ()
        {
            this.type = type;
        }

        public override void LoadContent(ContentManager content)
        {
            base.LoadContent(content);

            switch (type)
            {
                case TypeOfBlock.UP:
                    {
                        text = content.Load<Texture2D>("up");
                        break;
                    }

                case TypeOfBlock.DOWN:
                    {
                        text = content.Load<Texture2D>("down");
                        break;
                    }

                case TypeOfBlock.LEFT:
                    {
                        text = content.Load<Texture2D>("left");
                        break;
                    }

                case TypeOfBlock.RIGHT:
                    {
                        text = content.Load<Texture2D>("right");
                        break;
                    }

                case TypeOfBlock.END:
                    {
                        text = content.Load<Texture2D>("end");
                        break;
                    }
        
            }
        }

        protected override void doAction(int mX, int mY)
        {
            ConstructZone.getInstance().createNewBlock(type, mX, mY);
        }

        public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            spriteBatch.Draw(_texture, rectangle, Color.White);
            spriteBatch.Draw(text, rectangle, Color.White);
        }
        
    }
}

